import pygame
from spritesheet import *
from pygame.locals import *

class Board(pygame.sprite.Sprite):
	def __init__(self, spritesheet):
		pygame.sprite.Sprite.__init__(self)
		
		""" Draw this map to the board """
		self.tiles = 	[[7, 3, 3, 3, 3, 3, 3, 3, 3, 8],
			   		 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[1, 0, 0, 0, 0, 0, 0, 0, 0, 2],
					 	[5, 4, 4, 4, 4, 4, 4, 4, 4, 6]]

		self.image = pygame.surface.Surface((640, 640))
		self.rect = pygame.rect.Rect((0, 0), (640, 640))
		
		self._sprite = [pygame.rect.Rect((0, 64), (64, 64)),
						pygame.rect.Rect((64, 64), (64, 64)),
						pygame.rect.Rect((128, 64), (64, 64)),
						pygame.rect.Rect((192, 64), (64, 64)),
						pygame.rect.Rect((256, 64), (64, 64)),
						pygame.rect.Rect((320, 64), (64, 64)),
						pygame.rect.Rect((384, 64), (64, 64)),
						pygame.rect.Rect((448, 64), (64, 64)),
						pygame.rect.Rect((512, 64), (64, 64))]
		
		for y in range(10):
			for x in range(10):
				s_rect = self._sprite[self.tiles[y][x]]
				self.image.blit(spritesheet.get_image(s_rect), (x * 64, y * 64), Rect((0, 0), (64, 64)) )